#!/usr/bin/python
from pygooglechart import Chart
from pygooglechart import SimpleLineChart
from pygooglechart import Axis
from math import sqrt
def gn():
	return (1+sqrt(5))/2

def fibo(n):
	res=1
	if n>1 :
		res=fibo(n-1)+fibo(n-2)
	return res

val=[]
f=1
for i in range(1, 50):
	f=fibo(i)
	print "Fibo("+str(i)+") = "+ str(f)
	print "GN("+str(i)+") = "+ str(f*gn())
	
	val.insert(i, f)


# Set the vertical range from 0 to 100
max_y = f

# Chart size of 200x125 pixels and specifying the range for the Y axis
chart = SimpleLineChart(400, 250, y_range=[0, max_y])

# Add the chart data
chart.add_data(val)

# Set the line colour to blue
chart.set_colours(['0000FF'])

# Set the vertical stripes
chart.fill_linear_stripes(Chart.CHART, 0, 'CCCCCC', 0.2, 'FFFFFF', 0.2)

# Set the horizontal dotted lines
chart.set_grid(0, 25, 5, 5)

# The Y axis labels contains 0 to 100 skipping every 25, but remove the
# first number because it's obvious and gets in the way of the first X
# label.
left_axis = range(0, max_y + 1, 500)
left_axis[0] = ''
chart.set_axis_labels(Axis.LEFT, left_axis)

#chart.download('fibo2.png')
